package respx

import (
	"net/http"

	"github.com/tal-tech/go-zero/rest/httpx"
)

type reply struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func Success(w http.ResponseWriter, v interface{}) {
	httpx.OkJson(w, &reply{
		Code:    0,
		Message: "ok",
		Data:    v,
	})
}

func NoContent(w http.ResponseWriter) {
	w.WriteHeader(http.StatusNoContent)
}
